#!/usr/bin/env python
# -*- coding: utf-8 -*-

# 1.Module documentation
"""
    Some descriptions of this module
"""

# 2.Module imports
from django.http import HttpResponse, Http404, HttpResponseNotFound
from django.template import Context, loader
from django.shortcuts import render_to_response, get_object_or_404
from djsite_onlinelist.onlinelist.models import NDSSource, NDSGame

# 3.Global variables declarations
VERSION = "0.0.1"

# 4.Class declarations

# 5.Function declarations
def index(request):
    msg = "some notification message!"
    ndsgame_list = NDSGame.objects.all()
    t = loader.get_template('index.html')
    c = Context({'ndsgame_list': ndsgame_list, 'msg': msg})
    return HttpResponse(t.render(c))

def get_details(request, ndsgame_id):
    ndsgame = get_object_or_404(NDSGame, pk=ndsgame_id)
    t = loader.get_template('details.html')
    c = Context({'ndsgame': ndsgame})
    return HttpResponse(t.render(c))

def notfound(request):
    return HttpResponseNotFound('<h1>Page not found</h1>')

def test():
    pass

# 6.Main body
if __name__ == '__main__':
    test()
